package dp.state;

import dp.state.interfaces.State;

public class SoldState implements State {

	private GumballMachine gumballMachine;
	
	public SoldState(GumballMachine gumballMachine) {
		this.gumballMachine = gumballMachine;
	}
	
	public void dispense() {
		gumballMachine.releaseBall();
		if(gumballMachine.getCount() > 0)
		{
			gumballMachine.setState(gumballMachine.getNoQuarterState());
		}
		else
		{
			System.out.println("Oops, out of gumballs!");
			gumballMachine.setState(gumballMachine.getSoldOutState());
		}
	}

	public void ejectQuarter() {
		System.out.println("Sorry, you have already turned the crank");
	}

	public void insertQuarter() {
		System.out.println("Please wait, we're already giving you a gumball");
	}

	public void turnCrank() {
		System.out.println("Turning twice doesn't get you another gumball!");
	}

}

interface A {
	public void ma() throws Exception;
}

class B implements A {

	public void ma() {
		
	}
	
}